using System;

using Impact.Model.Objects;
using Impact.Model.Service;

using StructureMap;

namespace Impact.Controllers
{
    /// <summary>
    /// Responsible for controlling the menu system
    /// </summary>
    public static class MenuController
    {

        /// <summary>
        /// retrieve all pages that will be displayed on the menu
        /// </summary>
        public static ImpactPageCollection GetPages()
        {
            IPageService service = ObjectFactory.GetInstance<IPageService>();
            return service.FetchAllPages( true );
        }


        /// <summary>
        /// retrieve only the enabled pages that have no parent page
        /// </summary>
        /// <returns></returns>
        public static ImpactPageCollection GetTopLevelPages()
        {
            IPageService service = ObjectFactory.GetInstance<IPageService>();
            return service.FetchChildPages( -1, true );
        }

    }
}
